package com.ttn.student.controller;

import com.ttn.common.core.entity.Result;
import com.ttn.common.core.entity.studentrecord.GrammarTestStudyRecordDetails;
import com.ttn.common.core.entity.studentrecord.query.TestStudyRecordQuery;
import com.ttn.student.service.GrammarTestStudyRecordDetailsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * (grammar_test_study_record_details)表控制层
 *
 * @author xxxxx
 */
@RestController
@Slf4j
@RequestMapping("/grammar-test-study-record-details")
public class GrammarTestStudyRecordDetailsController {
    /**
     * 服务对象
     */
    @Resource
    private GrammarTestStudyRecordDetailsService grammarTestStudyRecordDetailsService;

    /**
     * 词汇学习记录
     *
     * @param request
     * @param grammarTestStudyRecordDetails
     * @return
     */
    @PostMapping("/save/grammar-test-study-record-details")
    public Result saveGrammarTestStudyRecordDetails(HttpServletRequest request,
                                                    @RequestBody GrammarTestStudyRecordDetails grammarTestStudyRecordDetails) {
        log.info("GrammarTestStudyRecordDetailsController saveGrammarTestStudyRecordDetails grammarTestStudyRecordDetails,参数:{}", grammarTestStudyRecordDetails);
        return grammarTestStudyRecordDetailsService.saveGrammarTestStudyRecordDetails(grammarTestStudyRecordDetails);
    }

    /**
     * 查询测试记录
     *
     * @param request
     * @param testStudyRecordQuery
     * @return
     */
    @PostMapping("/query/grammar-test-study-record-details")
    public Result queryGrammarTestStudyRecordDetails(HttpServletRequest request, @RequestBody TestStudyRecordQuery testStudyRecordQuery) {

        log.info("VocabularyStudyRecordDetailsController queryGrammarTestStudyRecordDetails ,参数:{}", testStudyRecordQuery);
        return grammarTestStudyRecordDetailsService.queryGrammarTestStudyRecordDetails(testStudyRecordQuery);
    }

}
